package NumberSix;

import java.util.HashSet;

public class Test {
    public static void main(String[] args) {
        //写个存储Student类型的HashSet集合
        HashSet<Student> students=new HashSet<>();
        students.add(new Student("张三",20,"男"));
        students.add(new Student("李四",21,"女"));
        students.add(new Student("张三",20,"男"));

        //遍历
        students.forEach(System.out::println);

        //因为重写了equals和hashCode方法所以会同时比较对象元素是否相同
    }
}
